<?php
 include "counter.php";

iamashowpage();

$uniqueid = $counter->get_input("uniqueid", "number", "get");
if (!$uniqueid) {
# test
$uniqueid = 445539477;
}

?>
<?php pagestart();
print "<html>\n";
pagehead("Machine-update entry");
?>
<BODY bgcolor="white">
<?php pagetop("Machine info returned by machine-update") ?>
<?php showmessage() ?>
<? $machineinfos = mysql_query("select * from automach
    where uniqueid = $uniqueid");
   if (!$machineinfos) {
       print("No machineinfo found for uniqueid $uniqueid\n");
   } else {
      $machineinfo = mysql_fetch_array($machineinfos);
       print("<h2>Machine info for " . $machineinfo["name"] . "</h2>\n");
       print "<table border=0>";
       print "<tr><td>Date of last update" . "<td>"
          . $machineinfo["updated"] . "\n";
       print "<tr><td>Sender email" . "<td>"
          . $machineinfo["mailfrom"] . "\n";
       print "<tr><td>Script version" . "<td>"
          . $machineinfo["method"] . "\n";
       print "<tr><td>Kernel version" . "<td>"
          . $machineinfo["kernel"] . "\n";
       print "<tr><td>CPU" . "<td>"
          . $machineinfo["cpu"] . "\n";
       print "<tr><td>Uptime" . "<td>"
          . $machineinfo["uptime"] . "\n";
       print "</table>\n";
       $adminuser = $counter->get_input("adminuser", "", "cookie");
       if (getenv("REMOTE_USER") || $adminuser) {
?>
<form method="post" action="/cgi-bin/adm/reprocess-automach.cgi">
<input type="hidden" name="uniqueid" value="<?php print $uniqueid ?>">
<input type="submit" value="Reprocess">
</form>
<?php           

           print "<h2>Last message</h2>\n(only shown to admins)<pre>";
	   print($machineinfo["lastmessage"]);
           print "</pre>\n";
       }
   }
?>

<?php pagebottom() ?>
</body>
</html>


